package com.usabb.domain;


import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.ifast.common.base.BaseDO;
import com.usabb.pojo.vo.CombosCategoryUpdateVO;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.ArrayList;
import java.util.List;

/**
 * <pre>
 * 月子中心 套餐 . 服务类目 . 条目
 * </pre>
 * <small> 2019-08-19 18:03:27 | Aron</small>
 */
@Data
@SuppressWarnings("serial")
@TableName("combos_category_item")
@EqualsAndHashCode(callSuper = true)
public class CombosCategoryItemDO extends BaseDO {
    @TableId
    private Long id;

    private Long categoryId;

    /**
     * 项目标号
     */
    private String itemNo;

    /**
     * 项目名称
     */
    private String itemName;

    /**
     * remark
     */
    private String itemRemark;

    /**
     * 1v1
     */
    private String itemIntro;



    public static List<CombosCategoryItemDO> ofItems(final CombosCategoryUpdateVO updateVO) {
        List<CombosCategoryItemDO> itemDOS = ofItems(updateVO.getItemNo(), updateVO.getItemName(),
                updateVO.getItemRemark(), updateVO.getItemIntro());

        itemDOS.forEach(it->it.setCategoryId(updateVO.getId()));

        return itemDOS;
    }


    public static List<CombosCategoryItemDO> ofItems(List<String> itemNoList,
                                                     List<String> itemNameList,
                                                     List<String> itemRemarkList,
                                                     List<String> itemIntroList) {

        List<CombosCategoryItemDO> itemList = new ArrayList<>(itemNoList.size());
        for (int j = 0; j < itemNoList.size(); j++) {
            CombosCategoryItemDO item = new CombosCategoryItemDO();
            item.setItemNo(itemNoList.get(j));
            item.setItemName(itemNameList.get(j));
            item.setItemRemark(itemRemarkList.get(j));
            item.setItemIntro(itemIntroList.get(j));

            itemList.add(item);
        }
        return itemList;
    }


}
